package com.tage;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


/**
 * @author wangshenbing
 */
@SpringBootApplication
public class SpringSecurityApp {
    public static void main(String[] args) {
        for (int i = 0; i < 7; i++) {
            System.out.println("i = " + adjustDirection(5F, 1, i));
        }
        SpringApplication.run(SpringSecurityApp.class, args);
    }

    private static float adjustDirection(Float originalDirection, double adjustAngle, int time) {
        if(0==time){
            return originalDirection;
        }
        if (time % 2 == 0) {
            return (float)(originalDirection - (double) ((time + 1) / 2) * adjustAngle);

        } else {
            return  (float)(originalDirection + (double) (time / 2 + 1) * adjustAngle);
        }
    }
}
